/**
 * 
 */
package com.nh.action;

import java.sql.Timestamp;

import com.nh.common.DictionaryKey;
import com.nh.entity.GKLClassType;
import com.nh.entity.NgAdmin;
import com.opensymphony.xwork2.Action;

/**
 * 项目名称：NotoginsengManage
 * 
 * 类名称：InitAction
 * 
 * 类描述：
 * 
 * 创建人：李兴建
 * 
 * E-mail:lxj08193@163.com
 * 
 * 创建时间：2012-11-9 下午01:22:35
 * 
 * 修改人：李兴建
 * 
 * 修改时间：2012-11-9 下午01:22:35
 * 
 * 修改备注：
 * 
 * @version
 */
public class InitAction extends BaseAction {

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	@Override
	public String execute() throws Exception {
		try {
			//------------------初始化字典----------------------------
			this.putDictionaryValue(DictionaryKey.DICTIONARY_KEY_VERIFICATION, "0");
			this.putDictionaryValue(DictionaryKey.DICTIONARY_KEY_KEYWORD, "");
			this.putDictionaryValue(DictionaryKey.DICTIONARY_KEY_KEYWORD_SETTYPE, "1");
			this.putDictionaryValue(DictionaryKey.DICTIONARY_KEY_CONSULTINGCONNECTION, "");
			// ----------------管理员------------------------
			NgAdmin superAdmin = new NgAdmin();
			superAdmin.setAdminType(1);
			superAdmin.setBeanState(0);
			superAdmin.setCreateadmin("系统自动生成");
			superAdmin.setLoginName("superadmin");
			superAdmin.setLoginPassword("superadmin");
			superAdmin.setRealEname("超级管理员");
			superAdmin.setState(0);
			superAdmin.setCreateTime(new Timestamp(System.currentTimeMillis()));
			this.getBaseService().save(superAdmin);
			this.getBaseService().save(AdminAction.getSuperAdminDefultAuthorization(superAdmin.getId()));

			superAdmin = new NgAdmin();
			superAdmin.setAdminType(0);
			superAdmin.setBeanState(0);
			superAdmin.setCreateadmin("管理员");
			superAdmin.setLoginName("admin");
			superAdmin.setLoginPassword("admin");
			superAdmin.setRealEname("管理员");
			superAdmin.setState(0);
			superAdmin.setCreateTime(new Timestamp(System.currentTimeMillis()));
			this.getBaseService().save(superAdmin);
			this.getBaseService().save(AdminAction.getAdminDefultAuthorization(superAdmin.getId()));

			superAdmin = new NgAdmin();
			superAdmin.setAdminType(2);
			superAdmin.setBeanState(0);
			superAdmin.setCreateadmin("超级管理员");
			superAdmin.setLoginName("zj");
			superAdmin.setLoginPassword("zj");
			superAdmin.setRealEname("专家");
			superAdmin.setState(0);
			superAdmin.setCreateTime(new Timestamp(System.currentTimeMillis()));
			this.getBaseService().save(superAdmin);
			this.getBaseService().save(AdminAction.getExpertDefultAuthorization(superAdmin.getId()));
			
			//默认测试类型
			this.getBaseService().save(new GKLClassType("产品推荐","疾病类",0));
			this.getBaseService().save(new GKLClassType("产品推荐","美容类",1));
			this.getBaseService().save(new GKLClassType("产品推荐","亚健康类",2));
			this.getBaseService().save(new GKLClassType("产品推荐","疑难杂症",3));
			this.getBaseService().save(new GKLClassType("产品推荐","其它",4));
			
			this.getBaseService().save(new GKLClassType("产品说明","个性化美容化妆品",0));
			this.getBaseService().save(new GKLClassType("产品说明","控制体重产品",1));
			this.getBaseService().save(new GKLClassType("产品说明","健康营养用品",2));
			this.getBaseService().save(new GKLClassType("产品说明","家庭清洁用品",3));
			this.getBaseService().save(new GKLClassType("产品说明","净化空气及水产品",4));
			this.getBaseService().save(new GKLClassType("产品说明","新品上市",5));
			this.getBaseService().save(new GKLClassType("产品说明","名声产品",6));
			
			this.getBaseService().save(new GKLClassType("更多帮助","通知公告",0));
			this.getBaseService().save(new GKLClassType("更多帮助","心得体会",1));
			this.getBaseService().save(new GKLClassType("更多帮助","资料大全",2));
			this.getBaseService().save(new GKLClassType("更多帮助","操作帮助",3));
			this.getBaseService().save(new GKLClassType("更多帮助","名声产品",4));

		} catch (Exception e) {
			e.printStackTrace();
			return Action.ERROR;
		}

		return Action.SUCCESS;
	}

	

}
